global root "C:\Users\hanwa\Desktop\replication"

use "$root\data\IMC_HA_Quarterly_Panel_clean.dta", replace

***Panel A: Overall complaints
preserve
drop if startdate==-1
drop if startdate<=201301
keep if cem_matched==1
stackedev complain imc, cohort(startdate) time(yearquarter) never_treat(no_treat) unit_fe(code) clust_unit(code) 
outreg2 using "$root\tables\table5", excel symbol(***,**,*) se replace
restore

preserve
drop if startdate==-1
drop if startdate<=201301
keep if cem_matched==1
stackedev complain imc, cohort(startdate) time(yearquarter) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage)
outreg2 using "$root\tables\table5", excel symbol(***,**,*) se append
restore

preserve
drop if startdate==-1
drop if startdate<=201301
keep if cem_matched==1
stackedev complain imc, cohort(startdate) time(yearquarter) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table5", excel symbol(***,**,*) se append
restore

preserve
drop if startdate==-1
drop if startdate<=201301
keep if cem_matched==1
stackedev complain imc, cohort(startdate) time(region_yq) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table5", excel symbol(***,**,*) se append
restore

***********H2*********
**********************
*********upheld*******

preserve
drop if startdate==-1
drop if startdate<=201301
keep if cem_matched==1
stackedev upheld imc, cohort(startdate) time(yearquarter) never_treat(no_treat) unit_fe(code) clust_unit(code) 
outreg2 using "$root\tables\table5", excel symbol(***,**,*) se append
restore

preserve
drop if startdate==-1
drop if startdate<=201301
keep if cem_matched==1
stackedev upheld imc, cohort(startdate) time(yearquarter) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage)
outreg2 using "$root\tables\table5", excel symbol(***,**,*) se append
restore

preserve
drop if startdate==-1
drop if startdate<=201301
keep if cem_matched==1
stackedev upheld imc, cohort(startdate) time(yearquarter) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table5", excel symbol(***,**,*) se append
restore

preserve
drop if startdate==-1
keep if cem_matched==1
stackedev upheld imc, cohort(startdate) time(region_yq) never_treat(no_treat) unit_fe(code) clust_unit(code)  covariates (deficit_rate grant_dependence lnpop lnclaim lnwage  kids private umemploy pension vulnerable )
outreg2 using "$root\tables\table5", excel symbol(***,**,*) se append
restore
